﻿namespace My.Hydrator.Tests
{
    using Microsoft.VisualStudio.TestTools.UnitTesting;

    [TestClass]
    public class HierarchyTests
    {
        [TestMethod]
        public void HydratorShouldPopulateClassWithClassConventionIfPresent()
        {
            var hydrator = new Hydrator();
            hydrator.Configure(x =>
                                   {
                                       x.For<Address>().Use(new AddressConvention());
                                       x.For<Address>().Property(y => y.City).Is(CommonType.AmericanCity);
                                       x.For<Address>().Property(y => y.State).Is(CommonType.AmericanState);
                                   });

            var person = hydrator.Hydrate<Person>();

            Assert.AreEqual("City", person.PhysicalAddress.City);
            Assert.AreEqual(-1, person.PhysicalAddress.State);
        }
    }
}
